import com.sun.xml.internal.ws.api.DistributedPropertySet;

import java.util.Scanner;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2024-01-24
 * Time:9:34
 */
public class Main {
    public static boolean isNumOrCharacter(char ch) {
        if((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z'))
            return true;
        return false;
    }

    public static boolean isPalindrome(String s) {
        s = s.toLowerCase();
        char[] array = s.toCharArray();
        int i = 0;
        int j = s.length()-1;
        while (i < j) {
            while (i < j && !isNumOrCharacter(array[i])) {
                ++i;
            }
            while (i < j && !isNumOrCharacter(array[j])) {
                --j;
            }
            if(array[i] == array[j]) {
                ++i;
                --j;
            } else {
                return false;
            }
        }
        return true;
    }


    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int index = s.lastIndexOf(" ");  //最后一个空格的下标
        //长度 = 字符串长度 -1 - 空格下标
        System.out.println(s.length()-1-index);
    }

}
